/******************************************************************************/
/* Files to Include                                                           */
/******************************************************************************/

#include <htc.h>            /* HiTech General Includes */
#include <stdint.h>         /* For uint8_t definition */
#include <stdbool.h>        /* For true/false definition */

#include "user.h"

/******************************************************************************/
/* User Functions                                                             */
/******************************************************************************/

/* <Initialize variables in user.h and insert code for user algorithms.> */

void InitApp(void)
{
    /* TODO Initialize User Ports/Peripherals/Project here */


    /* Setup analog functionality and port direction */
    ANSEL  = 0x00;
    ANSELH = 0x04;											/* AN10 SELECT*/

    /* Initialize peripherals */
    PORTA = 00;
    TRISA = 0x0C;
    WPUA  = 0x04;

	PORTB = 0x00;
//	TRISB = 0xF0;
	TRISB = 0x10;
	WPUB  = 0x00;

	PORTC = 0x00;
//	TRISC = 0xFF;
	TRISC = 0x00;

	OPTION_REG = 0x40;										/* T0clk = Fosc/4/4 = 500kHz/256 = 2kHz */

    /* Enable interrupts */
	INTCON = 0xA0;
	PIE1   = 0x00;
	PIE2   = 0x00;
	IOCA   = 0x00;
}

